package com.atlzk.seckill.seckill.controller;

import java.util.Arrays;
import java.util.Map;

//import org.apache.shiro.authz.annotation.RequiresPermissions;
import com.atlzk.group.tgou.entity.ResultMsg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.atlzk.seckill.seckill.entity.PorderEntity;
import com.atlzk.seckill.seckill.service.PorderService;
import com.atlzk.common.utils.PageUtils;
import com.atlzk.common.utils.R;


/**
 * @author liuzekun
 * @email 2803587841@gmail.com
 * @date 2021-06-30 16:41:32
 */
@RestController
@RequestMapping("seckill/porder")
public class PorderController {
    @Autowired
    private PorderService porderService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("seckill:porder:list")
    public R list(@RequestParam Map <String, Object> params) {
        PageUtils page = porderService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("seckill:porder:info")
    public R info(@PathVariable("id") Long id) {
        PorderEntity porder = porderService.getById(id);

        return R.ok().put("porder", porder);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("seckill:porder:save")
    public R save(@RequestBody PorderEntity porder) {
        porderService.save(porder);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("seckill:porder:update")
    public R update(@RequestBody PorderEntity porder) {
        porderService.updateById(porder);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("seckill:porder:delete")
    public R delete(@RequestBody Long[] ids) {
        porderService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }


}
